#include <iostream>
#include <string>

#include "tinyxml2.hpp"
#include "TestClass.hpp"
#include "ISerializable.hpp"

using namespace std;
using namespace tinyxml2;

string source = "<PlayerData><someBool type=\"BOOL\">false</someBool>" 
                "<someInt type=\"INT\">7</someInt>" 
                "<someFloat type=\"FLOAT\">7.9</someFloat>" 
                "<someString type=\"STRING\">test2</someString>"
                "<boolArr type=\"BOOL_ARR\">"
                "   <0>false</0><1>true</1>"
                "</boolArr>"
                "<intArr type=\"INT_ARR\">"
                "   <0>50</0><1>500</1><2>5000</2>"
                "</intArr>"
                "<floatArr type=\"FLOAT_ARR\">"
                "   <0>0.15</0><1>.25</1>"
                "</floatArr>"
                "<stringArr type=\"STRING_ARR\">"
                "   <0>test1</0><1>test2</1><2>test3</2>"
                "</stringArr>"
                "</PlayerData>";

int main() 
{    
    cout << endl << "Serialize Test" << endl;
    
    TestClass playerData;
    
    XMLDocument doc;
    doc.Parse(source.c_str());
    
    XMLDocument test;
    playerData.Serialize(&test, "PlayerData");
    
    playerData.Deserialize(&doc);
    playerData.Serialize(&test, "PlayerData");
    test.Print();
    
    return 0;
}

